#include "vars.h"
#include <iostream>
using namespace std;

float hilf = 0.0;
//aenderung

const GLfloat mat_gelblich[] = {0.5,0.5,0.35};
const GLfloat mat_weisslich[] = {0.7,0.7,0.6};
const GLfloat mat_emissionAn[] = {0.5,0.5,0.35,1.0};
const GLfloat mat_emissionAus[] = {0.0,0.0,0.0,1.0};



const RGBImage *steg       = LoadRGB((texturDir+"steg.sgi").c_str());
const RGBImage *steg_poller= LoadRGB((texturDir+"steg_poller.sgi").c_str());
const RGBImage *steg_balken= LoadRGB((texturDir+"steg_balken.sgi").c_str());
const RGBImage *boden        = LoadRGB((texturDir+"boden5k.sgi").c_str());

const RGBImage *pallete      = LoadRGB((texturDir+"pallete.sgi").c_str());
const RGBImage *schiffwand     = LoadRGB((texturDir+"schiffwand1.sgi").c_str());
const RGBImage *kajuete        = LoadRGB((texturDir+"kajuete.sgi").c_str());
const RGBImage *rettungsboote  = LoadRGB((texturDir+"rettungsboote.sgi").c_str());
const RGBImage *ladeflaeche    = LoadRGB((texturDir+"ladeflaeche.sgi").c_str());
const RGBImage *schifffenster  = LoadRGB((texturDir+"schifffenster.sgi").c_str());
const RGBImage *fassblau       = LoadRGB((texturDir+"FassBlau.sgi").c_str());
const RGBImage *fassrot        = LoadRGB((texturDir+"FassRot.sgi").c_str());
const RGBImage *conIndia      = LoadRGB((texturDir+"container_india.sgi").c_str());
const RGBImage *conIndia_back = LoadRGB((texturDir+"container_india_back.sgi").c_str());

const RGBImage *conAfrica      = LoadRGB((texturDir+"container_africa.sgi").c_str());
const RGBImage *conAfrica_back = LoadRGB((texturDir+"container_africa_back.sgi").c_str());

const RGBImage *conAmerica     = LoadRGB((texturDir+"container_america.sgi").c_str());
const RGBImage *conAmerica_back= LoadRGB((texturDir+"container_america_back.sgi").c_str());

const RGBImage *wasser =  LoadRGB((texturDir+"Water.sgi").c_str());

const RGBImage *sky_tag      = LoadRGB((texturDir+"sky_tag.sgi").c_str());
const RGBImage *sky_nacht    = LoadRGB((texturDir+"sky_nacht.sgi").c_str());

const RGBImage *kran_eisen01_64 = LoadRGB((texturDir+"kran_eisen01_64.sgi").c_str());
const RGBImage *kran_eisen02_64 = LoadRGB((texturDir+"kran_eisen02_64.sgi").c_str());
const RGBImage *kran_eisen03_64 = LoadRGB((texturDir+"kran_eisen03_64.sgi").c_str());
const RGBImage *kran_eisen04_64 = LoadRGB((texturDir+"kran_eisen04_64.sgi").c_str());
const RGBImage *kran_eisen05_128 = LoadRGB((texturDir+"kran_eisen05_128.sgi").c_str());
const RGBImage *kran_holz01_128 = LoadRGB((texturDir+"kran_holz01_128.sgi").c_str());
const RGBImage *kran_kabine_128 = LoadRGB((texturDir+"kran_kabine_128.sgi").c_str());
const RGBImage *kran_metall01_64 = LoadRGB((texturDir+"kran_metall01_64.sgi").c_str());
const RGBImage *kran_rumpf_64 = LoadRGB((texturDir+"kran_rumpf_64.sgi").c_str());
const RGBImage *kran_scheinwerfer_64 = LoadRGB((texturDir+"kran_scheinwerfer_64.sgi").c_str());
const RGBImage *kran_scheinwerferHell_64 = LoadRGB((texturDir+"kran_scheinwerferHell_64.sgi").c_str());
const RGBImage *kran_schwarz = LoadRGB((texturDir+"kran_schwarz.sgi").c_str());
const RGBImage *grau = LoadRGB((texturDir+"grau.sgi").c_str());

const   RGBImage *haussen        = LoadRGB((texturDir+"haussen.sgi").c_str());  
const   RGBImage *hinnen        = LoadRGB((texturDir+"hinnen.sgi").c_str()); 
const   RGBImage *raussen       = LoadRGB((texturDir+"raussen.sgi").c_str()); 
const   RGBImage *lsr           = LoadRGB((texturDir+"rettungsboote.sgi").c_str()); 
const   RGBImage *lampenaus           = LoadRGB((texturDir+"rettungsboote.sgi").c_str());
const   RGBImage *lampenan           = LoadRGB((texturDir+"kran_eisen03_64.sgi").c_str()); 


const RGBImage *poller_64 = LoadRGB((texturDir+"poller_64.sgi").c_str());

const   RGBImage *holz1        = LoadRGB((texturDir+"holz1.sgi").c_str()); 
const   RGBImage *holz2        = LoadRGB((texturDir+"holz2.sgi").c_str());
const   RGBImage *holz3        = LoadRGB((texturDir+"holz3.sgi").c_str());
const   RGBImage *holz4        = LoadRGB((texturDir+"holz4.sgi").c_str());

const   RGBImage *metal1        = LoadRGB((texturDir+"metal1.sgi").c_str()); 
const   RGBImage *metal2        = LoadRGB((texturDir+"metal2.sgi").c_str());
const   RGBImage *metal3        = LoadRGB((texturDir+"metal3.sgi").c_str());
const   RGBImage *metal4        = LoadRGB((texturDir+"metal4.sgi").c_str());

const   RGBImage *pboden       = LoadRGB((texturDir+"pboden.sgi").c_str());
const   RGBImage *hboden       = LoadRGB((texturDir+"hboden.sgi").c_str());
const   RGBImage *rboden       = LoadRGB((texturDir+"rboden.sgi").c_str());

const   RGBImage *tor          = LoadRGB((texturDir+"tor.sgi").c_str());
const   RGBImage *tuer          = LoadRGB((texturDir+"doors.sgi").c_str());
const   RGBImage *hfenster     = LoadRGB((texturDir+"fenster.sgi").c_str());


void safeDelete(const RGBImage *img)
{
  if(img!=0x0)
    {
      delete[] img;
      img = 0x0;
    }
}

void initTextures();
void clearMemory()
{
  cout << "Geben Speicher frei.\n";
  safeDelete(boden);
  safeDelete(pallete);
  safeDelete(schiffwand);
  safeDelete(kajuete);
  safeDelete(rettungsboote);
  safeDelete(ladeflaeche);
  safeDelete(schifffenster);
  safeDelete(fassblau);
  safeDelete(fassrot);
  safeDelete(conIndia);
  safeDelete(conIndia_back);
  safeDelete(conAmerica);
  safeDelete(conAmerica_back);
  safeDelete(conAfrica);
  safeDelete(conAfrica_back);
  safeDelete(wasser);

  safeDelete(kran_eisen01_64);
  safeDelete(kran_eisen02_64);
  safeDelete(kran_eisen03_64);
  safeDelete(kran_eisen04_64);
  safeDelete(kran_eisen05_128);
  safeDelete(kran_holz01_128);
  safeDelete(kran_kabine_128);
  safeDelete(kran_metall01_64);
  safeDelete(kran_rumpf_64);
  safeDelete(kran_scheinwerfer_64);
  safeDelete(kran_scheinwerferHell_64);
  safeDelete(kran_schwarz);
  safeDelete(grau);

  safeDelete(steg);
  safeDelete(sky_tag);
  safeDelete(sky_nacht);

  safeDelete(poller_64);

  safeDelete(haussen);
  safeDelete(hinnen);       
  safeDelete(raussen);      
  safeDelete(lsr);      
  safeDelete(lampenaus);    
  safeDelete(lampenan);     

  safeDelete(holz1);
  safeDelete(holz2);
  safeDelete(holz3);
  safeDelete(holz4);
  
  safeDelete(metal1);
  safeDelete(metal2);
  safeDelete(metal3);
  safeDelete(metal4);

  safeDelete(pboden);
  safeDelete(hboden);
  safeDelete(rboden);
  
  safeDelete(hfenster);
  safeDelete(tor);

  cout << "Allen Speicher freigegebn.\n";
}


